package com.qcu.mapper;

import com.qcu.dto.DoctorInfoDTO;
import com.qcu.entity.DoctorInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author MyComputer
* @description 针对表【doctor_info】的数据库操作Mapper
* @createDate 2025-03-29 16:30:58
* @Entity com.qcu.entity.DoctorInfo
*/
public interface DoctorInfoMapper extends BaseMapper<DoctorInfo> {

    @Select("select d.id as id, dm.name as dept_name,s.staff_id as doctor_id, CONCAT(s.first_name,s.last_name) as name, d.picture as picture, d.job, d.title \n" +
            "from staff_account as s \n" +
            "\tleft join doctor_info as d on d.doctor_id = s.staff_id\n" +
            "\tleft join doctor_menu as dm on dm.id = s.type\n" +
            "where d.state = 0 && s.role = 'STAFF' && dm.id = #{departmentId}")
    List<DoctorInfoDTO> getDoctors(Integer departmentId);
    @Select("select d.id as id, dm.name as dept_name,s.staff_id as doctor_id, CONCAT(s.first_name,s.last_name) as name, d.picture as picture, d.job, d.title \n" +
            "from staff_account as s \n" +
            "\tleft join doctor_info as d on d.doctor_id = s.staff_id\n" +
            "\tleft join doctor_menu as dm on dm.id = s.type\n" +
            "where (d.state is null || d.state = 0) && s.role = 'STAFF'")
    List<DoctorInfoDTO> getDoctorsAll();
}




